package com.zzzyh.forumsystemclient.dao;

import com.zzzyh.forumsystemclient.model.Article;
import com.zzzyh.forumsystemclient.model.Moment;
import com.zzzyh.forumsystemclient.model.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserMapper {
    int insert(User row);

    int insertSelective(User row);

    User selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(User row);

    int updateByPrimaryKey(User row);

    /**
     * 根据用户名查找用户
     * @param username 用户名
     * @return 用户对象
     */
    User selectByUsername(String username);

    void updatePassword(@Param("encodedNewPassword") String encodedNewPassword, @Param("id") Integer userId);

    Integer selectByUsernameAndEmail(@Param("username")String username, @Param("email")String email);

    Integer selectUserIdByUsername(String username);

    List<Integer> getFriends(Integer userId);

    void updateUserIpInfo(User ipUser);

    List<Moment> myTalk(Integer userId);

    void delMyTalk(Integer talkId);

    List<User> getUserInfoByKeyword(String keyword);

    Integer isFollowAuthor(@Param("myId") Integer myId, @Param("userId") Integer userId);

    void followUser(@Param("myId") Integer myId, @Param("userId") Integer userId);

    void updateFollwUser(@Param("myId") Integer myId, @Param("userId") Integer userId);

    void unFollowUser(@Param("myId") Integer myId, @Param("userId") Integer userId);

    Integer totalPosts(Integer userId);

    Integer totalLikes(Integer userId);
    Integer totalFollowers(Integer userId);

    List<Integer> getAdminFriendsList();

}